# RA Haugerud, U.S. Geological Survey, 2011-2016

"""
following wpgcmykgdict, the following functions are defined:

isWPGCMYKGcolor(color)
hsv2wpg(hsv)
wpg2hsv(wpg,hsv)  returns old value of v if it is larger than new value of v
wpg2rgb(wpg)
cmy2hsv(cmy)
hsv2cmy(hsv)
cmy2wpg(cmy)
wpg2cmy(wpg)

for these functions, wpg is an integer
 arguments cmy and hsv are strings
returned values of wpg are integer
returned values of hsv and cmy are strings
"""

from GeMS_utilityFunctions import stringIsGeMSNull

def isWPGCMYKGcolor(color):
    if color == None:
        return False
    i = str(color)
    if stringIsGeMSNull(i) or i.isspace():
        return False
    i = int(color)
    if i >= 0 and i <= 999:
        return True
    else:
        return False

# dictionary of wpgcmykg => rgb => hsv => cmy translations
# built using color transformations provided by workstation ArcInfo
wpgcmykgdict = {
    0:['255,255,255','0,0,100','0,0,0'],
    1:['255,235,255','300,8,100','0,8,0'],
    2:['255,222,255','300,13,100','0,13,0'],
    3:['255,204,255','300,20,100','0,20,0'],
    4:['255,179,255','300,30,100','0,30,0'],
    5:['255,153,255','300,40,100','0,40,0'],
    6:['255,128,255','300,50,100','0,50,0'],
    7:['255,102,255','300,60,100','0,60,0'],
    8:['255,77,255','300,70,100','0,70,0'],
    9:['255,0,255','300,100,100','0,100,0'],
    10:['255,255,235','60,8,100','0,0,8'],
    11:['255,235,235','0,8,100','0,8,8'],
    12:['255,222,235','337,13,100','0,13,8'],
    13:['255,204,235','324,20,100','0,20,8'],
    14:['255,179,235','316,30,100','0,30,8'],
    15:['255,153,235','312,40,100','0,40,8'],
    16:['255,128,235','310,50,100','0,50,8'],
    17:['255,102,235','308,60,100','0,60,8'],
    18:['255,77,235','307,70,100','0,70,8'],
    19:['255,0,235','305,100,100','0,100,8'],
    20:['255,255,222','60,13,100','0,0,13'],
    21:['255,235,222','23,13,100','0,8,13'],
    22:['255,222,222','0,13,100','0,13,13'],
    23:['255,204,222','339,20,100','0,20,13'],
    24:['255,179,222','326,30,100','0,30,13'],
    25:['255,153,222','320,40,100','0,40,13'],
    26:['255,128,222','316,50,100','0,50,13'],
    27:['255,102,222','313,60,100','0,60,13'],
    28:['255,77,222','311,70,100','0,70,13'],
    29:['255,0,222','308,100,100','0,100,13'],
    30:['255,255,204','60,20,100','0,0,20'],
    31:['255,235,204','36,20,100','0,8,20'],
    32:['255,222,204','21,20,100','0,13,20'],
    33:['255,204,204','0,20,100','0,20,20'],
    34:['255,179,204','340,30,100','0,30,20'],
    35:['255,153,204','330,40,100','0,40,20'],
    36:['255,128,204','324,50,100','0,50,20'],
    37:['255,102,204','320,60,100','0,60,20'],
    38:['255,77,204','317,70,100','0,70,20'],
    39:['255,0,204','312,100,100','0,100,20'],
    40:['255,255,179','60,30,100','0,0,30'],
    41:['255,235,179','44,30,100','0,8,30'],
    42:['255,222,179','34,30,100','0,13,30'],
    43:['255,204,179','20,30,100','0,20,30'],
    44:['255,179,179','0,30,100','0,30,30'],
    45:['255,153,179','345,40,100','0,40,30'],
    46:['255,128,179','336,50,100','0,50,30'],
    47:['255,102,179','330,60,100','0,60,30'],
    48:['255,77,179','326,70,100','0,70,30'],
    49:['255,0,179','318,100,100','0,100,30'],
    50:['255,255,153','60,40,100','0,0,40'],
    51:['255,235,153','48,40,100','0,8,40'],
    52:['255,222,153','41,40,100','0,13,40'],
    53:['255,204,153','30,40,100','0,20,40'],
    54:['255,179,153','15,40,100','0,30,40'],
    55:['255,153,153','0,40,100','0,40,40'],
    56:['255,128,153','348,50,100','0,50,40'],
    57:['255,102,153','340,60,100','0,60,40'],
    58:['255,77,153','334,70,100','0,70,40'],
    59:['255,0,153','324,100,100','0,100,40'],
    60:['255,255,128','60,50,100','0,0,50'],
    61:['255,235,128','50,50,100','0,8,50'],
    62:['255,222,128','44,50,100','0,13,50'],
    63:['255,204,128','36,50,100','0,20,50'],
    64:['255,179,128','24,50,100','0,30,50'],
    65:['255,153,128','12,50,100','0,40,50'],
    66:['255,128,128','0,50,100','0,50,50'],
    67:['255,102,128','350,60,100','0,60,50'],
    68:['255,77,128','343,70,100','0,70,50'],
    69:['255,0,128','330,100,100','0,100,50'],
    70:['255,255,102','60,60,100','0,0,60'],
    71:['255,235,102','52,60,100','0,8,60'],
    72:['255,222,102','47,60,100','0,13,60'],
    73:['255,204,102','40,60,100','0,20,60'],
    74:['255,179,102','30,60,100','0,30,60'],
    75:['255,153,102','20,60,100','0,40,60'],
    76:['255,128,102','10,60,100','0,50,60'],
    77:['255,102,102','0,60,100','0,60,60'],
    78:['255,77,102','351,70,100','0,70,60'],
    79:['255,0,102','336,100,100','0,100,60'],
    80:['255,255,77','60,70,100','0,0,70'],
    81:['255,235,77','53,70,100','0,8,70'],
    82:['255,222,77','49,70,100','0,13,70'],
    83:['255,204,77','43,70,100','0,20,70'],
    84:['255,179,77','34,70,100','0,30,70'],
    85:['255,153,77','26,70,100','0,40,70'],
    86:['255,128,77','17,70,100','0,50,70'],
    87:['255,102,77','9,70,100','0,60,70'],
    88:['255,77,77','0,70,100','0,70,70'],
    89:['255,0,77','342,100,100','0,100,70'],
    90:['255,255,0','60,100,100','0,0,100'],
    91:['255,235,0','55,100,100','0,8,100'],
    92:['255,222,0','52,100,100','0,13,100'],
    93:['255,204,0','48,100,100','0,20,100'],
    94:['255,179,0','42,100,100','0,30,100'],
    95:['255,153,0','36,100,100','0,40,100'],
    96:['255,128,0','30,100,100','0,50,100'],
    97:['255,102,0','24,100,100','0,60,100'],
    98:['255,77,0','18,100,100','0,70,100'],
    99:['255,0,0','0,100,100','0,100,100'],
    100:['235,255,255','180,8,100','8,0,0'],
    101:['235,235,255','240,8,100','8,8,0'],
    102:['235,222,255','263,13,100','8,13,0'],
    103:['235,204,255','276,20,100','8,20,0'],
    104:['235,179,255','284,30,100','8,30,0'],
    105:['235,153,255','288,40,100','8,40,0'],
    106:['235,128,255','290,50,100','8,50,0'],
    107:['235,102,255','292,60,100','8,60,0'],
    108:['235,77,255','293,70,100','8,70,0'],
    109:['235,0,255','295,100,100','8,100,0'],
    110:['235,255,235','120,8,100','8,0,8'],
    111:['235,235,232','60,1,92','8,8,9'],
    112:['235,222,235','300,5,92','8,13,8'],
    113:['235,204,235','300,13,92','8,20,8'],
    114:['235,179,235','300,24,92','8,30,8'],
    115:['235,153,235','300,35,92','8,40,8'],
    116:['235,128,235','300,46,92','8,50,8'],
    117:['235,102,235','300,57,92','8,60,8'],
    118:['235,77,235','300,67,92','8,70,8'],
    119:['235,0,235','300,100,92','8,100,8'],
    120:['235,255,222','97,13,100','8,0,13'],
    121:['235,235,222','60,5,92','8,8,13'],
    122:['235,222,222','0,5,92','8,13,13'],
    123:['235,204,222','325,13,92','8,20,13'],
    124:['235,179,222','314,24,92','8,30,13'],
    125:['235,153,222','309,35,92','8,40,13'],
    126:['235,128,222','307,46,92','8,50,13'],
    127:['235,102,222','306,57,92','8,60,13'],
    128:['235,77,222','305,67,92','8,70,13'],
    129:['235,0,222','303,100,92','8,100,13'],
    130:['235,255,204','84,20,100','8,0,20'],
    131:['235,235,204','60,13,92','8,8,20'],
    132:['235,222,204','35,13,92','8,13,20'],
    133:['235,204,204','0,13,92','8,20,20'],
    134:['235,179,204','333,24,92','8,30,20'],
    135:['235,153,204','323,35,92','8,40,20'],
    136:['235,128,204','317,46,92','8,50,20'],
    137:['235,102,204','314,57,92','8,60,20'],
    138:['235,77,204','312,67,92','8,70,20'],
    139:['235,0,204','308,100,92','8,100,20'],
    140:['235,255,179','76,30,100','8,0,30'],
    141:['235,235,179','60,24,92','8,8,30'],
    142:['235,222,179','46,24,92','8,13,30'],
    143:['235,204,179','27,24,92','8,20,30'],
    144:['235,179,179','0,24,92','8,30,30'],
    145:['235,153,179','341,35,92','8,40,30'],
    146:['235,128,179','331,46,92','8,50,30'],
    147:['235,102,179','325,57,92','8,60,30'],
    148:['235,77,179','321,67,92','8,70,30'],
    149:['235,0,179','314,100,92','8,100,30'],
    150:['235,255,153','72,40,100','8,0,40'],
    151:['235,235,153','60,35,92','8,8,40'],
    152:['235,222,153','51,35,92','8,13,40'],
    153:['235,204,153','38,35,92','8,20,40'],
    154:['235,179,153','19,35,92','8,30,40'],
    155:['235,153,153','0,35,92','8,40,40'],
    156:['235,128,153','346,46,92','8,50,40'],
    157:['235,102,153','337,57,92','8,60,40'],
    158:['235,77,153','331,67,92','8,70,40'],
    159:['235,0,153','321,100,92','8,100,40'],
    160:['235,255,128','70,50,100','8,0,50'],
    161:['235,235,128','60,46,92','8,8,50'],
    162:['235,222,128','53,46,92','8,13,50'],
    163:['235,204,128','43,46,92','8,20,50'],
    164:['235,179,128','29,46,92','8,30,50'],
    165:['235,153,128','14,46,92','8,40,50'],
    166:['235,128,128','0,46,92','8,50,50'],
    167:['235,102,128','348,57,92','8,60,50'],
    168:['235,77,128','341,67,92','8,70,50'],
    169:['235,0,128','327,100,92','8,100,50'],
    170:['235,255,102','68,60,100','8,0,60'],
    171:['235,235,102','60,57,92','8,8,60'],
    172:['235,222,102','54,57,92','8,13,60'],
    173:['235,204,102','46,57,92','8,20,60'],
    174:['235,179,102','35,57,92','8,30,60'],
    175:['235,153,102','23,57,92','8,40,60'],
    176:['235,128,102','12,57,92','8,50,60'],
    177:['235,102,102','0,57,92','8,60,60'],
    178:['235,77,102','350,67,92','8,70,60'],
    179:['235,0,102','334,100,92','8,100,60'],
    180:['235,255,77','67,70,100','8,0,70'],
    181:['235,235,77','60,67,92','8,8,70'],
    182:['235,222,77','55,67,92','8,13,70'],
    183:['235,204,77','48,67,92','8,20,70'],
    184:['235,179,77','39,67,92','8,30,70'],
    185:['235,153,77','29,67,92','8,40,70'],
    186:['235,128,77','19,67,92','8,50,70'],
    187:['235,102,77','10,67,92','8,60,70'],
    188:['235,77,77','0,67,92','8,70,70'],
    189:['235,0,77','340,100,92','8,100,70'],
    190:['235,255,0','65,100,100','8,0,100'],
    191:['235,235,0','60,100,92','8,8,100'],
    192:['235,222,0','57,100,92','8,13,100'],
    193:['235,204,0','52,100,92','8,20,100'],
    194:['235,179,0','46,100,92','8,30,100'],
    195:['235,153,0','39,100,92','8,40,100'],
    196:['235,128,0','33,100,92','8,50,100'],
    197:['235,102,0','26,100,92','8,60,100'],
    198:['235,77,0','20,100,92','8,70,100'],
    199:['235,0,0','0,100,92','8,100,100'],
    200:['222,255,255','180,13,100','13,0,0'],
    201:['222,235,255','217,13,100','13,8,0'],
    202:['222,222,255','240,13,100','13,13,0'],
    203:['222,204,255','261,20,100','13,20,0'],
    204:['222,179,255','274,30,100','13,30,0'],
    205:['222,153,255','281,40,100','13,40,0'],
    206:['222,128,255','284,50,100','13,50,0'],
    207:['222,102,255','287,60,100','13,60,0'],
    208:['222,77,255','289,70,100','13,70,0'],
    209:['222,0,255','292,100,100','13,100,0'],
    210:['222,255,235','143,13,100','13,0,8'],
    211:['222,235,235','180,5,92','13,8,8'],
    212:['222,222,235','240,5,92','13,13,8'],
    213:['222,204,235','275,13,92','13,20,8'],
    214:['222,179,235','286,24,92','13,30,8'],
    215:['222,153,235','291,35,92','13,40,8'],
    216:['222,128,235','293,46,92','13,50,8'],
    217:['222,102,235','294,57,92','13,60,8'],
    218:['222,77,235','295,67,92','13,70,8'],
    219:['222,0,235','297,100,92','13,100,8'],
    220:['222,255,222','120,13,100','13,0,13'],
    221:['222,235,222','120,5,92','13,8,13'],
    222:['222,222,219','60,1,87','13,13,14'],
    223:['222,204,222','300,8,87','13,20,13'],
    224:['222,179,222','300,20,87','13,30,13'],
    225:['222,153,222','300,31,87','13,40,13'],
    226:['222,128,222','300,43,87','13,50,13'],
    227:['222,102,222','300,54,87','13,60,13'],
    228:['222,77,222','300,66,87','13,70,13'],
    229:['222,0,222','300,100,87','13,100,13'],
    230:['222,255,204','99,20,100','13,0,20'],
    231:['222,235,204','85,13,92','13,8,20'],
    232:['222,222,204','60,8,87','13,13,20'],
    233:['222,204,204','0,8,87','13,20,20'],
    234:['222,179,204','325,20,87','13,30,20'],
    235:['222,153,204','316,31,87','13,40,20'],
    236:['222,128,204','311,43,87','13,50,20'],
    237:['222,102,204','309,54,87','13,60,20'],
    238:['222,77,204','307,66,87','13,70,20'],
    239:['222,0,204','305,100,87','13,100,20'],
    240:['222,255,179','86,30,100','13,0,30'],
    241:['222,235,179','74,24,92','13,8,30'],
    242:['222,222,179','60,20,87','13,13,30'],
    243:['222,204,179','35,20,87','13,20,30'],
    244:['222,179,179','0,20,87','13,30,30'],
    245:['222,153,179','338,31,87','13,40,30'],
    246:['222,128,179','328,43,87','13,50,30'],
    247:['222,102,179','322,54,87','13,60,30'],
    248:['222,77,179','318,66,87','13,70,30'],
    249:['222,0,179','312,100,87','13,100,30'],
    250:['222,255,153','80,40,100','13,0,40'],
    251:['222,235,153','69,35,92','13,8,40'],
    252:['222,222,153','60,31,87','13,13,40'],
    253:['222,204,153','44,31,87','13,20,40'],
    254:['222,179,153','22,31,87','13,30,40'],
    255:['222,153,153','0,31,87','13,40,40'],
    256:['222,128,153','344,43,87','13,50,40'],
    257:['222,102,153','334,54,87','13,60,40'],
    258:['222,77,153','328,66,87','13,70,40'],
    259:['222,0,153','319,100,87','13,100,40'],
    260:['222,255,128','76,50,100','13,0,50'],
    261:['222,235,128','67,46,92','13,8,50'],
    262:['222,222,128','60,43,87','13,13,50'],
    263:['222,204,128','49,43,87','13,20,50'],
    264:['222,179,128','32,43,87','13,30,50'],
    265:['222,153,128','16,43,87','13,40,50'],
    266:['222,128,128','0,43,87','13,50,50'],
    267:['222,102,128','347,54,87','13,60,50'],
    268:['222,77,128','339,66,87','13,70,50'],
    269:['222,0,128','326,100,87','13,100,50'],
    270:['222,255,102','73,60,100','13,0,60'],
    271:['222,235,102','66,57,92','13,8,60'],
    272:['222,222,102','60,54,87','13,13,60'],
    273:['222,204,102','51,54,87','13,20,60'],
    274:['222,179,102','38,54,87','13,30,60'],
    275:['222,153,102','26,54,87','13,40,60'],
    276:['222,128,102','13,54,87','13,50,60'],
    277:['222,102,102','0,54,87','13,60,60'],
    278:['222,77,102','349,66,87','13,70,60'],
    279:['222,0,102','332,100,87','13,100,60'],
    280:['222,255,77','71,70,100','13,0,70'],
    281:['222,235,77','65,67,92','13,8,70'],
    282:['222,222,77','60,66,87','13,13,70'],
    283:['222,204,77','53,66,87','13,20,70'],
    284:['222,179,77','42,66,87','13,30,70'],
    285:['222,153,77','32,66,87','13,40,70'],
    286:['222,128,77','21,66,87','13,50,70'],
    287:['222,102,77','11,66,87','13,60,70'],
    288:['222,77,77','0,66,87','13,70,70'],
    289:['222,0,77','339,100,87','13,100,70'],
    290:['222,255,0','68,100,100','13,0,100'],
    291:['222,235,0','63,100,92','13,8,100'],
    292:['222,222,0','60,100,87','13,13,100'],
    293:['222,204,0','55,100,87','13,20,100'],
    294:['222,179,0','48,100,87','13,30,100'],
    295:['222,153,0','41,100,87','13,40,100'],
    296:['222,128,0','34,100,87','13,50,100'],
    297:['222,102,0','28,100,87','13,60,100'],
    298:['222,77,0','21,100,87','13,70,100'],
    299:['222,0,0','0,100,87','13,100,100'],
    300:['204,255,255','180,20,100','20,0,0'],
    301:['204,235,255','204,20,100','20,8,0'],
    302:['204,222,255','219,20,100','20,13,0'],
    303:['204,204,255','240,20,100','20,20,0'],
    304:['204,179,255','260,30,100','20,30,0'],
    305:['204,153,255','270,40,100','20,40,0'],
    306:['204,128,255','276,50,100','20,50,0'],
    307:['204,102,255','280,60,100','20,60,0'],
    308:['204,77,255','283,70,100','20,70,0'],
    309:['204,0,255','288,100,100','20,100,0'],
    310:['204,255,235','156,20,100','20,0,8'],
    311:['204,235,235','180,13,92','20,8,8'],
    312:['204,222,235','205,13,92','20,13,8'],
    313:['204,204,235','240,13,92','20,20,8'],
    314:['204,179,235','267,24,92','20,30,8'],
    315:['204,153,235','278,35,92','20,40,8'],
    316:['204,128,235','283,46,92','20,50,8'],
    317:['204,102,235','286,57,92','20,60,8'],
    318:['204,77,235','288,67,92','20,70,8'],
    319:['204,0,235','292,100,92','20,100,8'],
    320:['204,255,222','141,20,100','20,0,13'],
    321:['204,235,222','155,13,92','20,8,13'],
    322:['204,222,222','180,8,87','20,13,13'],
    323:['204,204,222','240,8,87','20,20,13'],
    324:['204,179,222','275,20,87','20,30,13'],
    325:['204,153,222','284,31,87','20,40,13'],
    326:['204,128,222','289,43,87','20,50,13'],
    327:['204,102,222','291,54,87','20,60,13'],
    328:['204,77,222','293,66,87','20,70,13'],
    329:['204,0,222','295,100,87','20,100,13'],
    330:['204,255,204','120,20,100','20,0,20'],
    331:['204,235,204','120,13,92','20,8,20'],
    332:['204,222,204','120,8,87','20,13,20'],
    333:['204,204,201','60,1,80','20,20,21'],
    334:['204,179,204','300,13,80','20,30,20'],
    335:['204,153,204','300,25,80','20,40,20'],
    336:['204,128,204','300,38,80','20,50,20'],
    337:['204,102,204','300,50,80','20,60,20'],
    338:['204,77,204','300,63,80','20,70,20'],
    339:['204,0,204','300,100,80','20,100,20'],
    340:['204,255,179','100,30,100','20,0,30'],
    341:['204,235,179','93,24,92','20,8,30'],
    342:['204,222,179','85,20,87','20,13,30'],
    343:['204,204,179','60,13,80','20,20,30'],
    344:['204,179,179','0,13,80','20,30,30'],
    345:['204,153,179','330,25,80','20,40,30'],
    346:['204,128,179','320,38,80','20,50,30'],
    347:['204,102,179','315,50,80','20,60,30'],
    348:['204,77,179','312,63,80','20,70,30'],
    349:['204,0,179','308,100,80','20,100,30'],
    350:['204,255,153','90,40,100','20,0,40'],
    351:['204,235,153','83,35,92','20,8,40'],
    352:['204,222,153','76,31,87','20,13,40'],
    353:['204,204,153','60,25,80','20,20,40'],
    354:['204,179,153','30,25,80','20,30,40'],
    355:['204,153,153','0,25,80','20,40,40'],
    356:['204,128,153','340,38,80','20,50,40'],
    357:['204,102,153','330,50,80','20,60,40'],
    358:['204,77,153','324,63,80','20,70,40'],
    359:['204,0,153','315,100,80','20,100,40'],
    360:['204,255,128','84,50,100','20,0,50'],
    361:['204,235,128','77,46,92','20,8,50'],
    362:['204,222,128','71,43,87','20,13,50'],
    363:['204,204,128','60,38,80','20,20,50'],
    364:['204,179,128','40,38,80','20,30,50'],
    365:['204,153,128','20,38,80','20,40,50'],
    366:['204,128,128','0,38,80','20,50,50'],
    367:['204,102,128','345,50,80','20,60,50'],
    368:['204,77,128','336,63,80','20,70,50'],
    369:['204,0,128','323,100,80','20,100,50'],
    370:['204,255,102','80,60,100','20,0,60'],
    371:['204,235,102','74,57,92','20,8,60'],
    372:['204,222,102','69,54,87','20,13,60'],
    373:['204,204,102','60,50,80','20,20,60'],
    374:['204,179,102','45,50,80','20,30,60'],
    375:['204,153,102','30,50,80','20,40,60'],
    376:['204,128,102','15,50,80','20,50,60'],
    377:['204,102,102','0,50,80','20,60,60'],
    378:['204,77,102','348,63,80','20,70,60'],
    379:['204,0,102','330,100,80','20,100,60'],
    380:['204,255,77','77,70,100','20,0,70'],
    381:['204,235,77','72,67,92','20,8,70'],
    382:['204,222,77','67,66,87','20,13,70'],
    383:['204,204,77','60,63,80','20,20,70'],
    384:['204,179,77','48,63,80','20,30,70'],
    385:['204,153,77','36,63,80','20,40,70'],
    386:['204,128,77','24,63,80','20,50,70'],
    387:['204,102,77','12,63,80','20,60,70'],
    388:['204,77,77','0,63,80','20,70,70'],
    389:['204,0,77','338,100,80','20,100,70'],
    390:['204,255,0','72,100,100','20,0,100'],
    391:['204,235,0','68,100,92','20,8,100'],
    392:['204,222,0','65,100,87','20,13,100'],
    393:['204,204,0','60,100,80','20,20,100'],
    394:['204,179,0','53,100,80','20,30,100'],
    395:['204,153,0','45,100,80','20,40,100'],
    396:['204,128,0','38,100,80','20,50,100'],
    397:['204,102,0','30,100,80','20,60,100'],
    398:['204,77,0','23,100,80','20,70,100'],
    399:['204,0,0','0,100,80','20,100,100'],
    400:['179,255,255','180,30,100','30,0,0'],
    401:['179,235,255','196,30,100','30,8,0'],
    402:['179,222,255','206,30,100','30,13,0'],
    403:['179,204,255','220,30,100','30,20,0'],
    404:['179,179,255','240,30,100','30,30,0'],
    405:['179,153,255','255,40,100','30,40,0'],
    406:['179,128,255','264,50,100','30,50,0'],
    407:['179,102,255','270,60,100','30,60,0'],
    408:['179,77,255','274,70,100','30,70,0'],
    409:['179,0,255','282,100,100','30,100,0'],
    410:['179,255,235','164,30,100','30,0,8'],
    411:['179,235,235','180,24,92','30,8,8'],
    412:['179,222,235','194,24,92','30,13,8'],
    413:['179,204,235','213,24,92','30,20,8'],
    414:['179,179,235','240,24,92','30,30,8'],
    415:['179,153,235','259,35,92','30,40,8'],
    416:['179,128,235','269,46,92','30,50,8'],
    417:['179,102,235','275,57,92','30,60,8'],
    418:['179,77,235','279,67,92','30,70,8'],
    419:['179,0,235','286,100,92','30,100,8'],
    420:['179,255,222','154,30,100','30,0,13'],
    421:['179,235,222','166,24,92','30,8,13'],
    422:['179,222,222','180,20,87','30,13,13'],
    423:['179,204,222','205,20,87','30,20,13'],
    424:['179,179,222','240,20,87','30,30,13'],
    425:['179,153,222','262,31,87','30,40,13'],
    426:['179,128,222','272,43,87','30,50,13'],
    427:['179,102,222','278,54,87','30,60,13'],
    428:['179,77,222','282,66,87','30,70,13'],
    429:['179,0,222','288,100,87','30,100,13'],
    430:['179,255,204','140,30,100','30,0,20'],
    431:['179,235,204','147,24,92','30,8,20'],
    432:['179,222,204','155,20,87','30,13,20'],
    433:['179,204,204','180,13,80','30,20,20'],
    434:['179,179,204','240,13,80','30,30,20'],
    435:['179,153,204','270,25,80','30,40,20'],
    436:['179,128,204','280,38,80','30,50,20'],
    437:['179,102,204','285,50,80','30,60,20'],
    438:['179,77,204','288,63,80','30,70,20'],
    439:['179,0,204','293,100,80','30,100,20'],
    440:['179,255,179','120,30,100','30,0,30'],
    441:['179,235,179','120,24,92','30,8,30'],
    442:['179,222,179','120,20,87','30,13,30'],
    443:['179,204,179','120,13,80','30,20,30'],
    444:['179,179,176','60,1,70','30,30,31'],
    445:['179,153,179','300,14,70','30,40,30'],
    446:['179,128,179','300,29,70','30,50,30'],
    447:['179,102,179','300,43,70','30,60,30'],
    448:['179,77,179','300,57,70','30,70,30'],
    449:['179,0,179','300,100,70','30,100,30'],
    450:['179,255,153','105,40,100','30,0,40'],
    451:['179,235,153','101,35,92','30,8,40'],
    452:['179,222,153','98,31,87','30,13,40'],
    453:['179,204,153','90,25,80','30,20,40'],
    454:['179,179,153','60,14,70','30,30,40'],
    455:['179,153,153','0,14,70','30,40,40'],
    456:['179,128,153','330,29,70','30,50,40'],
    457:['179,102,153','320,43,70','30,60,40'],
    458:['179,77,153','315,57,70','30,70,40'],
    459:['179,0,153','309,100,70','30,100,40'],
    460:['179,255,128','96,50,100','30,0,50'],
    461:['179,235,128','91,46,92','30,8,50'],
    462:['179,222,128','88,43,87','30,13,50'],
    463:['179,204,128','80,38,80','30,20,50'],
    464:['179,179,128','60,29,70','30,30,50'],
    465:['179,153,128','30,29,70','30,40,50'],
    466:['179,128,128','0,29,70','30,50,50'],
    467:['179,102,128','340,43,70','30,60,50'],
    468:['179,77,128','330,57,70','30,70,50'],
    469:['179,0,128','317,100,70','30,100,50'],
    470:['179,255,102','90,60,100','30,0,60'],
    471:['179,235,102','85,57,92','30,8,60'],
    472:['179,222,102','82,54,87','30,13,60'],
    473:['179,204,102','75,50,80','30,20,60'],
    474:['179,179,102','60,43,70','30,30,60'],
    475:['179,153,102','40,43,70','30,40,60'],
    476:['179,128,102','20,43,70','30,50,60'],
    477:['179,102,102','0,43,70','30,60,60'],
    478:['179,77,102','345,57,70','30,70,60'],
    479:['179,0,102','326,100,70','30,100,60'],
    480:['179,255,77','86,70,100','30,0,70'],
    481:['179,235,77','81,67,92','30,8,70'],
    482:['179,222,77','78,66,87','30,13,70'],
    483:['179,204,77','72,63,80','30,20,70'],
    484:['179,179,77','60,57,70','30,30,70'],
    485:['179,153,77','45,57,70','30,40,70'],
    486:['179,128,77','30,57,70','30,50,70'],
    487:['179,102,77','15,57,70','30,60,70'],
    488:['179,77,77','0,57,70','30,70,70'],
    489:['179,0,77','334,100,70','30,100,70'],
    490:['179,255,0','78,100,100','30,0,100'],
    491:['179,235,0','74,100,92','30,8,100'],
    492:['179,222,0','72,100,87','30,13,100'],
    493:['179,204,0','68,100,80','30,20,100'],
    494:['179,179,0','60,100,70','30,30,100'],
    495:['179,153,0','51,100,70','30,40,100'],
    496:['179,128,0','43,100,70','30,50,100'],
    497:['179,102,0','34,100,70','30,60,100'],
    498:['179,77,0','26,100,70','30,70,100'],
    499:['179,0,0','0,100,70','30,100,100'],
    500:['153,255,255','180,40,100','40,0,0'],
    501:['153,235,255','192,40,100','40,8,0'],
    502:['153,222,255','200,40,100','40,13,0'],
    503:['153,204,255','210,40,100','40,20,0'],
    504:['153,179,255','225,40,100','40,30,0'],
    505:['153,153,255','240,40,100','40,40,0'],
    506:['153,128,255','252,50,100','40,50,0'],
    507:['153,102,255','260,60,100','40,60,0'],
    508:['153,77,255','266,70,100','40,70,0'],
    509:['153,0,255','276,100,100','40,100,0'],
    510:['153,255,235','168,40,100','40,0,8'],
    511:['153,235,235','180,35,92','40,8,8'],
    512:['153,222,235','189,35,92','40,13,8'],
    513:['153,204,235','203,35,92','40,20,8'],
    514:['153,179,235','221,35,92','40,30,8'],
    515:['153,153,235','240,35,92','40,40,8'],
    516:['153,128,235','254,46,92','40,50,8'],
    517:['153,102,235','263,57,92','40,60,8'],
    518:['153,77,235','269,67,92','40,70,8'],
    519:['153,0,235','279,100,92','40,100,8'],
    520:['153,255,222','161,40,100','40,0,13'],
    521:['153,235,222','171,35,92','40,8,13'],
    522:['153,222,222','180,31,87','40,13,13'],
    523:['153,204,222','196,31,87','40,20,13'],
    524:['153,179,222','218,31,87','40,30,13'],
    525:['153,153,222','240,31,87','40,40,13'],
    526:['153,128,222','256,43,87','40,50,13'],
    527:['153,102,222','266,54,87','40,60,13'],
    528:['153,77,222','272,66,87','40,70,13'],
    529:['153,0,222','281,100,87','40,100,13'],
    530:['153,255,204','150,40,100','40,0,20'],
    531:['153,235,204','158,35,92','40,8,20'],
    532:['153,222,204','164,31,87','40,13,20'],
    533:['153,204,204','180,25,80','40,20,20'],
    534:['153,179,204','210,25,80','40,30,20'],
    535:['153,153,204','240,25,80','40,40,20'],
    536:['153,128,204','260,38,80','40,50,20'],
    537:['153,102,204','270,50,80','40,60,20'],
    538:['153,77,204','276,63,80','40,70,20'],
    539:['153,0,204','285,100,80','40,100,20'],
    540:['153,255,179','135,40,100','40,0,30'],
    541:['153,235,179','139,35,92','40,8,30'],
    542:['153,222,179','142,31,87','40,13,30'],
    543:['153,204,179','150,25,80','40,20,30'],
    544:['153,179,179','180,14,70','40,30,30'],
    545:['153,153,179','240,14,70','40,40,30'],
    546:['153,128,179','270,29,70','40,50,30'],
    547:['153,102,179','280,43,70','40,60,30'],
    548:['153,77,179','285,57,70','40,70,30'],
    549:['153,0,179','291,100,70','40,100,30'],
    550:['153,255,153','120,40,100','40,0,40'],
    551:['153,235,153','120,35,92','40,8,40'],
    552:['153,222,153','120,31,87','40,13,40'],
    553:['153,204,153','120,25,80','40,20,40'],
    554:['153,179,153','120,14,70','40,30,40'],
    555:['153,153,150','60,2,60','40,40,41'],
    556:['153,128,153','300,17,60','40,50,40'],
    557:['153,102,153','300,33,60','40,60,40'],
    558:['153,77,153','300,50,60','40,70,40'],
    559:['153,0,153','300,100,60','40,100,40'],
    560:['153,255,128','108,50,100','40,0,50'],
    561:['153,235,128','106,46,92','40,8,50'],
    562:['153,222,128','104,43,87','40,13,50'],
    563:['153,204,128','100,38,80','40,20,50'],
    564:['153,179,128','90,29,70','40,30,50'],
    565:['153,153,128','60,17,60','40,40,50'],
    566:['153,128,128','0,17,60','40,50,50'],
    567:['153,102,128','330,33,60','40,60,50'],
    568:['153,77,128','320,50,60','40,70,50'],
    569:['153,0,128','310,100,60','40,100,50'],
    570:['153,255,102','100,60,100','40,0,60'],
    571:['153,235,102','97,57,92','40,8,60'],
    572:['153,222,102','94,54,87','40,13,60'],
    573:['153,204,102','90,50,80','40,20,60'],
    574:['153,179,102','80,43,70','40,30,60'],
    575:['153,153,102','60,33,60','40,40,60'],
    576:['153,128,102','30,33,60','40,50,60'],
    577:['153,102,102','0,33,60','40,60,60'],
    578:['153,77,102','340,50,60','40,70,60'],
    579:['153,0,102','320,100,60','40,100,60'],
    580:['153,255,77','94,70,100','40,0,70'],
    581:['153,235,77','91,67,92','40,8,70'],
    582:['153,222,77','88,66,87','40,13,70'],
    583:['153,204,77','84,63,80','40,20,70'],
    584:['153,179,77','75,57,70','40,30,70'],
    585:['153,153,77','60,50,60','40,40,70'],
    586:['153,128,77','40,50,60','40,50,70'],
    587:['153,102,77','20,50,60','40,60,70'],
    588:['153,77,77','0,50,60','40,70,70'],
    589:['153,0,77','330,100,60','40,100,70'],
    590:['153,255,0','84,100,100','40,0,100'],
    591:['153,235,0','81,100,92','40,8,100'],
    592:['153,222,0','79,100,87','40,13,100'],
    593:['153,204,0','75,100,80','40,20,100'],
    594:['153,179,0','69,100,70','40,30,100'],
    595:['153,153,0','60,100,60','40,40,100'],
    596:['153,128,0','50,100,60','40,50,100'],
    597:['153,102,0','40,100,60','40,60,100'],
    598:['153,77,0','30,100,60','40,70,100'],
    599:['153,0,0','0,100,60','40,100,100'],
    600:['128,255,255','180,50,100','50,0,0'],
    601:['128,235,255','190,50,100','50,8,0'],
    602:['128,222,255','196,50,100','50,13,0'],
    603:['128,204,255','204,50,100','50,20,0'],
    604:['128,179,255','216,50,100','50,30,0'],
    605:['128,153,255','228,50,100','50,40,0'],
    606:['128,128,255','240,50,100','50,50,0'],
    607:['128,102,255','250,60,100','50,60,0'],
    608:['128,77,255','257,70,100','50,70,0'],
    609:['128,0,255','270,100,100','50,100,0'],
    610:['128,255,235','170,50,100','50,0,8'],
    611:['128,235,235','180,46,92','50,8,8'],
    612:['128,222,235','187,46,92','50,13,8'],
    613:['128,204,235','197,46,92','50,20,8'],
    614:['128,179,235','211,46,92','50,30,8'],
    615:['128,153,235','226,46,92','50,40,8'],
    616:['128,128,235','240,46,92','50,50,8'],
    617:['128,102,235','252,57,92','50,60,8'],
    618:['128,77,235','259,67,92','50,70,8'],
    619:['128,0,235','273,100,92','50,100,8'],
    620:['128,255,222','164,50,100','50,0,13'],
    621:['128,235,222','173,46,92','50,8,13'],
    622:['128,222,222','180,43,87','50,13,13'],
    623:['128,204,222','191,43,87','50,20,13'],
    624:['128,179,222','208,43,87','50,30,13'],
    625:['128,153,222','224,43,87','50,40,13'],
    626:['128,128,222','240,43,87','50,50,13'],
    627:['128,102,222','253,54,87','50,60,13'],
    628:['128,77,222','261,66,87','50,70,13'],
    629:['128,0,222','274,100,87','50,100,13'],
    630:['128,255,204','156,50,100','50,0,20'],
    631:['128,235,204','163,46,92','50,8,20'],
    632:['128,222,204','169,43,87','50,13,20'],
    633:['128,204,204','180,38,80','50,20,20'],
    634:['128,179,204','200,38,80','50,30,20'],
    635:['128,153,204','220,38,80','50,40,20'],
    636:['128,128,204','240,38,80','50,50,20'],
    637:['128,102,204','255,50,80','50,60,20'],
    638:['128,77,204','264,63,80','50,70,20'],
    639:['128,0,204','278,100,80','50,100,20'],
    640:['128,255,179','144,50,100','50,0,30'],
    641:['128,235,179','149,46,92','50,8,30'],
    642:['128,222,179','152,43,87','50,13,30'],
    643:['128,204,179','160,38,80','50,20,30'],
    644:['128,179,179','180,29,70','50,30,30'],
    645:['128,153,179','210,29,70','50,40,30'],
    646:['128,128,179','240,29,70','50,50,30'],
    647:['128,102,179','260,43,70','50,60,30'],
    648:['128,77,179','270,57,70','50,70,30'],
    649:['128,0,179','283,100,70','50,100,30'],
    650:['128,255,153','132,50,100','50,0,40'],
    651:['128,235,153','134,46,92','50,8,40'],
    652:['128,222,153','136,43,87','50,13,40'],
    653:['128,204,153','140,38,80','50,20,40'],
    654:['128,179,153','150,29,70','50,30,40'],
    655:['128,153,153','180,17,60','50,40,40'],
    656:['128,128,153','240,17,60','50,50,40'],
    657:['128,102,153','270,33,60','50,60,40'],
    658:['128,77,153','280,50,60','50,70,40'],
    659:['128,0,153','290,100,60','50,100,40'],
    660:['128,255,128','120,50,100','50,0,50'],
    661:['128,235,128','120,46,92','50,8,50'],
    662:['128,222,128','120,43,87','50,13,50'],
    663:['128,204,128','120,38,80','50,20,50'],
    664:['128,179,128','120,29,70','50,30,50'],
    665:['128,153,128','120,17,60','50,40,50'],
    666:['128,128,125','60,2,50','50,50,51'],
    667:['128,102,128','300,20,50','50,60,50'],
    668:['128,77,128','300,40,50','50,70,50'],
    669:['128,0,128','300,100,50','50,100,50'],
    670:['128,255,102','110,60,100','50,0,60'],
    671:['128,235,102','108,57,92','50,8,60'],
    672:['128,222,102','107,54,87','50,13,60'],
    673:['128,204,102','105,50,80','50,20,60'],
    674:['128,179,102','100,43,70','50,30,60'],
    675:['128,153,102','90,33,60','50,40,60'],
    676:['128,128,102','60,20,50','50,50,60'],
    677:['128,102,102','0,20,50','50,60,60'],
    678:['128,77,102','330,40,50','50,70,60'],
    679:['128,0,102','312,100,50','50,100,60'],
    680:['128,255,77','103,70,100','50,0,70'],
    681:['128,235,77','101,67,92','50,8,70'],
    682:['128,222,77','99,66,87','50,13,70'],
    683:['128,204,77','96,63,80','50,20,70'],
    684:['128,179,77','90,57,70','50,30,70'],
    685:['128,153,77','80,50,60','50,40,70'],
    686:['128,128,77','60,40,50','50,50,70'],
    687:['128,102,77','30,40,50','50,60,70'],
    688:['128,77,77','0,40,50','50,70,70'],
    689:['128,0,77','324,100,50','50,100,70'],
    690:['128,255,0','90,100,100','50,0,100'],
    691:['128,235,0','87,100,92','50,8,100'],
    692:['128,222,0','86,100,87','50,13,100'],
    693:['128,204,0','83,100,80','50,20,100'],
    694:['128,179,0','77,100,70','50,30,100'],
    695:['128,153,0','70,100,60','50,40,100'],
    696:['128,128,0','60,100,50','50,50,100'],
    697:['128,102,0','48,100,50','50,60,100'],
    698:['128,77,0','36,100,50','50,70,100'],
    699:['128,0,0','0,100,50','50,100,100'],
    700:['102,255,255','180,60,100','60,0,0'],
    701:['102,235,255','188,60,100','60,8,0'],
    702:['102,222,255','193,60,100','60,13,0'],
    703:['102,204,255','200,60,100','60,20,0'],
    704:['102,179,255','210,60,100','60,30,0'],
    705:['102,153,255','220,60,100','60,40,0'],
    706:['102,128,255','230,60,100','60,50,0'],
    707:['102,102,255','240,60,100','60,60,0'],
    708:['102,77,255','249,70,100','60,70,0'],
    709:['102,0,255','264,100,100','60,100,0'],
    710:['102,255,235','172,60,100','60,0,8'],
    711:['102,235,235','180,57,92','60,8,8'],
    712:['102,222,235','186,57,92','60,13,8'],
    713:['102,204,235','194,57,92','60,20,8'],
    714:['102,179,235','205,57,92','60,30,8'],
    715:['102,153,235','217,57,92','60,40,8'],
    716:['102,128,235','228,57,92','60,50,8'],
    717:['102,102,235','240,57,92','60,60,8'],
    718:['102,77,235','250,67,92','60,70,8'],
    719:['102,0,235','266,100,92','60,100,8'],
    720:['102,255,222','167,60,100','60,0,13'],
    721:['102,235,222','174,57,92','60,8,13'],
    722:['102,222,222','180,54,87','60,13,13'],
    723:['102,204,222','189,54,87','60,20,13'],
    724:['102,179,222','202,54,87','60,30,13'],
    725:['102,153,222','214,54,87','60,40,13'],
    726:['102,128,222','227,54,87','60,50,13'],
    727:['102,102,222','240,54,87','60,60,13'],
    728:['102,77,222','251,66,87','60,70,13'],
    729:['102,0,222','268,100,87','60,100,13'],
    730:['102,255,204','160,60,100','60,0,20'],
    731:['102,235,204','166,57,92','60,8,20'],
    732:['102,222,204','171,54,87','60,13,20'],
    733:['102,204,204','180,50,80','60,20,20'],
    734:['102,179,204','195,50,80','60,30,20'],
    735:['102,153,204','210,50,80','60,40,20'],
    736:['102,128,204','225,50,80','60,50,20'],
    737:['102,102,204','240,50,80','60,60,20'],
    738:['102,77,204','252,63,80','60,70,20'],
    739:['102,0,204','270,100,80','60,100,20'],
    740:['102,255,179','150,60,100','60,0,30'],
    741:['102,235,179','155,57,92','60,8,30'],
    742:['102,222,179','158,54,87','60,13,30'],
    743:['102,204,179','165,50,80','60,20,30'],
    744:['102,179,179','180,43,70','60,30,30'],
    745:['102,153,179','200,43,70','60,40,30'],
    746:['102,128,179','220,43,70','60,50,30'],
    747:['102,102,179','240,43,70','60,60,30'],
    748:['102,77,179','255,57,70','60,70,30'],
    749:['102,0,179','274,100,70','60,100,30'],
    750:['102,255,153','140,60,100','60,0,40'],
    751:['102,235,153','143,57,92','60,8,40'],
    752:['102,222,153','146,54,87','60,13,40'],
    753:['102,204,153','150,50,80','60,20,40'],
    754:['102,179,153','160,43,70','60,30,40'],
    755:['102,153,153','180,33,60','60,40,40'],
    756:['102,128,153','210,33,60','60,50,40'],
    757:['102,102,153','240,33,60','60,60,40'],
    758:['102,77,153','260,50,60','60,70,40'],
    759:['102,0,153','280,100,60','60,100,40'],
    760:['102,255,128','130,60,100','60,0,50'],
    761:['102,235,128','132,57,92','60,8,50'],
    762:['102,222,128','133,54,87','60,13,50'],
    763:['102,204,128','135,50,80','60,20,50'],
    764:['102,179,128','140,43,70','60,30,50'],
    765:['102,153,128','150,33,60','60,40,50'],
    766:['102,128,128','180,20,50','60,50,50'],
    767:['102,102,128','240,20,50','60,60,50'],
    768:['102,77,128','270,40,50','60,70,50'],
    769:['102,0,128','288,100,50','60,100,50'],
    770:['102,255,102','120,60,100','60,0,60'],
    771:['102,235,102','120,57,92','60,8,60'],
    772:['102,222,102','120,54,87','60,13,60'],
    773:['102,204,102','120,50,80','60,20,60'],
    774:['102,179,102','120,43,70','60,30,60'],
    775:['102,153,102','120,33,60','60,40,60'],
    776:['102,128,102','120,20,50','60,50,60'],
    777:['102,102,99','60,3,40','60,60,61'],
    778:['102,77,102','300,25,40','60,70,60'],
    779:['102,0,102','300,100,40','60,100,60'],
    780:['102,255,77','111,70,100','60,0,70'],
    781:['102,235,77','110,67,92','60,8,70'],
    782:['102,222,77','109,66,87','60,13,70'],
    783:['102,204,77','108,63,80','60,20,70'],
    784:['102,179,77','105,57,70','60,30,70'],
    785:['102,153,77','100,50,60','60,40,70'],
    786:['102,128,77','90,40,50','60,50,70'],
    787:['102,102,77','60,25,40','60,60,70'],
    788:['102,77,77','0,25,40','60,70,70'],
    789:['102,0,77','315,100,40','60,100,70'],
    790:['102,255,0','96,100,100','60,0,100'],
    791:['102,235,0','94,100,92','60,8,100'],
    792:['102,222,0','92,100,87','60,13,100'],
    793:['102,204,0','90,100,80','60,20,100'],
    794:['102,179,0','86,100,70','60,30,100'],
    795:['102,153,0','80,100,60','60,40,100'],
    796:['102,128,0','72,100,50','60,50,100'],
    797:['102,102,0','60,100,40','60,60,100'],
    798:['102,77,0','45,100,40','60,70,100'],
    799:['102,0,0','0,100,40','60,100,100'],
    800:['77,255,255','180,70,100','70,0,0'],
    801:['77,235,255','187,70,100','70,8,0'],
    802:['77,222,255','191,70,100','70,13,0'],
    803:['77,204,255','197,70,100','70,20,0'],
    804:['77,179,255','206,70,100','70,30,0'],
    805:['77,153,255','214,70,100','70,40,0'],
    806:['77,128,255','223,70,100','70,50,0'],
    807:['77,102,255','231,70,100','70,60,0'],
    808:['77,77,255','240,70,100','70,70,0'],
    809:['77,0,255','258,100,100','70,100,0'],
    810:['77,255,235','173,70,100','70,0,8'],
    811:['77,235,235','180,67,92','70,8,8'],
    812:['77,222,235','185,67,92','70,13,8'],
    813:['77,204,235','192,67,92','70,20,8'],
    814:['77,179,235','201,67,92','70,30,8'],
    815:['77,153,235','211,67,92','70,40,8'],
    816:['77,128,235','221,67,92','70,50,8'],
    817:['77,102,235','230,67,92','70,60,8'],
    818:['77,77,235','240,67,92','70,70,8'],
    819:['77,0,235','260,100,92','70,100,8'],
    820:['77,255,222','169,70,100','70,0,13'],
    821:['77,235,222','175,67,92','70,8,13'],
    822:['77,222,222','180,66,87','70,13,13'],
    823:['77,204,222','187,66,87','70,20,13'],
    824:['77,179,222','198,66,87','70,30,13'],
    825:['77,153,222','208,66,87','70,40,13'],
    826:['77,128,222','219,66,87','70,50,13'],
    827:['77,102,222','229,66,87','70,60,13'],
    828:['77,77,222','240,66,87','70,70,13'],
    829:['77,0,222','261,100,87','70,100,13'],
    830:['77,255,204','163,70,100','70,0,20'],
    831:['77,235,204','168,67,92','70,8,20'],
    832:['77,222,204','173,66,87','70,13,20'],
    833:['77,204,204','180,63,80','70,20,20'],
    834:['77,179,204','192,63,80','70,30,20'],
    835:['77,153,204','204,63,80','70,40,20'],
    836:['77,128,204','216,63,80','70,50,20'],
    837:['77,102,204','228,63,80','70,60,20'],
    838:['77,77,204','240,63,80','70,70,20'],
    839:['77,0,204','263,100,80','70,100,20'],
    840:['77,255,179','154,70,100','70,0,30'],
    841:['77,235,179','159,67,92','70,8,30'],
    842:['77,222,179','162,66,87','70,13,30'],
    843:['77,204,179','168,63,80','70,20,30'],
    844:['77,179,179','180,57,70','70,30,30'],
    845:['77,153,179','195,57,70','70,40,30'],
    846:['77,128,179','210,57,70','70,50,30'],
    847:['77,102,179','225,57,70','70,60,30'],
    848:['77,77,179','240,57,70','70,70,30'],
    849:['77,0,179','266,100,70','70,100,30'],
    850:['77,255,153','146,70,100','70,0,40'],
    851:['77,235,153','149,67,92','70,8,40'],
    852:['77,222,153','152,66,87','70,13,40'],
    853:['77,204,153','156,63,80','70,20,40'],
    854:['77,179,153','165,57,70','70,30,40'],
    855:['77,153,153','180,50,60','70,40,40'],
    856:['77,128,153','200,50,60','70,50,40'],
    857:['77,102,153','220,50,60','70,60,40'],
    858:['77,77,153','240,50,60','70,70,40'],
    859:['77,0,153','270,100,60','70,100,40'],
    860:['77,255,128','137,70,100','70,0,50'],
    861:['77,235,128','139,67,92','70,8,50'],
    862:['77,222,128','141,66,87','70,13,50'],
    863:['77,204,128','144,63,80','70,20,50'],
    864:['77,179,128','150,57,70','70,30,50'],
    865:['77,153,128','160,50,60','70,40,50'],
    866:['77,128,128','180,40,50','70,50,50'],
    867:['77,102,128','210,40,50','70,60,50'],
    868:['77,77,128','240,40,50','70,70,50'],
    869:['77,0,128','276,100,50','70,100,50'],
    870:['77,255,102','129,70,100','70,0,60'],
    871:['77,235,102','130,67,92','70,8,60'],
    872:['77,222,102','131,66,87','70,13,60'],
    873:['77,204,102','132,63,80','70,20,60'],
    874:['77,179,102','135,57,70','70,30,60'],
    875:['77,153,102','140,50,60','70,40,60'],
    876:['77,128,102','150,40,50','70,50,60'],
    877:['77,102,102','180,25,40','70,60,60'],
    878:['77,77,102','240,25,40','70,70,60'],
    879:['77,0,102','285,100,40','70,100,60'],
    880:['77,255,77','120,70,100','70,0,70'],
    881:['77,235,77','120,67,92','70,8,70'],
    882:['77,222,77','120,66,87','70,13,70'],
    883:['77,204,77','120,63,80','70,20,70'],
    884:['77,179,77','120,57,70','70,30,70'],
    885:['77,153,77','120,50,60','70,40,70'],
    886:['77,128,77','120,40,50','70,50,70'],
    887:['77,102,77','120,25,40','70,60,70'],
    888:['77,77,74','60,3,30','70,70,71'],
    889:['77,0,77','300,100,30','70,100,70'],
    890:['77,255,0','102,100,100','70,0,100'],
    891:['77,235,0','100,100,92','70,8,100'],
    892:['77,222,0','99,100,87','70,13,100'],
    893:['77,204,0','98,100,80','70,20,100'],
    894:['77,179,0','94,100,70','70,30,100'],
    895:['77,153,0','90,100,60','70,40,100'],
    896:['77,128,0','84,100,50','70,50,100'],
    897:['77,102,0','75,100,40','70,60,100'],
    898:['77,77,0','60,100,30','70,70,100'],
    899:['77,0,0','0,100,30','70,100,100'],
    900:['0,255,255','180,100,100','100,0,0'],
    901:['0,235,255','185,100,100','100,8,0'],
    902:['0,222,255','188,100,100','100,13,0'],
    903:['0,204,255','192,100,100','100,20,0'],
    904:['0,179,255','198,100,100','100,30,0'],
    905:['0,153,255','204,100,100','100,40,0'],
    906:['0,128,255','210,100,100','100,50,0'],
    907:['0,102,255','216,100,100','100,60,0'],
    908:['0,77,255','222,100,100','100,70,0'],
    909:['0,0,255','240,100,100','100,100,0'],
    910:['0,255,235','175,100,100','100,0,8'],
    911:['0,235,235','180,100,92','100,8,8'],
    912:['0,222,235','183,100,92','100,13,8'],
    913:['0,204,235','188,100,92','100,20,8'],
    914:['0,179,235','194,100,92','100,30,8'],
    915:['0,153,235','201,100,92','100,40,8'],
    916:['0,128,235','207,100,92','100,50,8'],
    917:['0,102,235','214,100,92','100,60,8'],
    918:['0,77,235','220,100,92','100,70,8'],
    919:['0,0,235','240,100,92','100,100,8'],
    920:['0,255,222','172,100,100','100,0,13'],
    921:['0,235,222','177,100,92','100,8,13'],
    922:['0,222,222','180,100,87','100,13,13'],
    923:['0,204,222','185,100,87','100,20,13'],
    924:['0,179,222','192,100,87','100,30,13'],
    925:['0,153,222','199,100,87','100,40,13'],
    926:['0,128,222','206,100,87','100,50,13'],
    927:['0,102,222','212,100,87','100,60,13'],
    928:['0,77,222','219,100,87','100,70,13'],
    929:['0,0,222','240,100,87','100,100,13'],
    930:['0,255,204','168,100,100','100,0,20'],
    931:['0,235,204','172,100,92','100,8,20'],
    932:['0,222,204','175,100,87','100,13,20'],
    933:['0,204,204','180,100,80','100,20,20'],
    934:['0,179,204','188,100,80','100,30,20'],
    935:['0,153,204','195,100,80','100,40,20'],
    936:['0,128,204','203,100,80','100,50,20'],
    937:['0,102,204','210,100,80','100,60,20'],
    938:['0,77,204','218,100,80','100,70,20'],
    939:['0,0,204','240,100,80','100,100,20'],
    940:['0,255,179','162,100,100','100,0,30'],
    941:['0,235,179','166,100,92','100,8,30'],
    942:['0,222,179','168,100,87','100,13,30'],
    943:['0,204,179','173,100,80','100,20,30'],
    944:['0,179,179','180,100,70','100,30,30'],
    945:['0,153,179','189,100,70','100,40,30'],
    946:['255,255,255','0,0,100','0,0,0'],
    947:['242,242,242','0,0,95','5,5,5'],
    948:['235,235,235','0,0,92','8,8,8'],
    949:['230,230,230','0,0,90','10,10,10'],
    950:['0,255,153','156,100,100','100,0,40'],
    951:['0,235,153','159,100,92','100,8,40'],
    952:['0,222,153','161,100,87','100,13,40'],
    953:['0,204,153','165,100,80','100,20,40'],
    954:['0,179,153','171,100,70','100,30,40'],
    955:['0,153,153','180,100,60','100,40,40'],
    956:['222,222,222','0,0,87','13,13,13'],
    957:['217,217,217','0,0,85','15,15,15'],
    958:['204,204,204','0,0,80','20,20,20'],
    959:['191,191,191','0,0,75','25,25,25'],
    960:['0,255,128','150,100,100','100,0,50'],
    961:['0,235,128','153,100,92','100,8,50'],
    962:['0,222,128','154,100,87','100,13,50'],
    963:['0,204,128','158,100,80','100,20,50'],
    964:['0,179,128','163,100,70','100,30,50'],
    965:['0,153,128','170,100,60','100,40,50'],
    966:['179,179,179','0,0,70','30,30,30'],
    967:['166,166,166','0,0,65','35,35,35'],
    968:['153,153,153','0,0,60','40,40,40'],
    969:['140,140,140','0,0,55','45,45,45'],
    970:['0,255,102','144,100,100','100,0,60'],
    971:['0,235,102','146,100,92','100,8,60'],
    972:['0,222,102','148,100,87','100,13,60'],
    973:['0,204,102','150,100,80','100,20,60'],
    974:['0,179,102','154,100,70','100,30,60'],
    975:['0,153,102','160,100,60','100,40,60'],
    976:['128,128,128','0,0,50','50,50,50'],
    977:['115,115,115','0,0,45','55,55,55'],
    978:['102,102,102','0,0,40','60,60,60'],
    979:['89,89,89','0,0,35','65,65,65'],
    980:['0,255,77','138,100,100','100,0,70'],
    981:['0,235,77','140,100,92','100,8,70'],
    982:['0,222,77','141,100,87','100,13,70'],
    983:['0,204,77','143,100,80','100,20,70'],
    984:['0,179,77','146,100,70','100,30,70'],
    985:['0,153,77','150,100,60','100,40,70'],
    986:['77,77,77','0,0,30','70,70,70'],
    987:['64,64,64','0,0,25','75,75,75'],
    988:['51,51,51','0,0,20','80,80,80'],
    989:['38,38,38','0,0,15','85,85,85'],
    990:['0,255,0','120,100,100','100,0,100'],
    991:['0,235,0','120,100,92','100,8,100'],
    992:['0,222,0','120,100,87','100,13,100'],
    993:['0,204,0','120,100,80','100,20,100'],
    994:['0,179,0','120,100,70','100,30,100'],
    995:['0,153,0','120,100,60','100,40,100'],
    996:['26,26,26','0,0,10','90,90,90'],
    997:['13,13,13','0,0,5','95,95,95'],
    998:['0,0,0','0,0,0','100,100,100'],
    999:['0,0,0','0,0,0','100,100,100']
}

c = ','

def hsv2wpg(hsv):
    cmy = hsv2cmy(hsv)
    wpg = cmy2wpg(cmy)
    return wpg

def wpg2hsv(wpg,hsv):
    oldV = hsv.split(c)[2]
    #cmy = wpg2cmy(wpg)
    #newHsv = cmy2hsv(cmy)
    newHsv = wpgcmykgdict[int(wpg)][1]
    if float(oldV) > float(newHsv.split(c)[2]):
        # replace newV with oldV
        newHsv = newHsv.split(c)[0]+c+newHsv.split(c)[1]+c+oldV
    return newHsv

def wpg2rgb(wpg):
    rgb = wpgcmykgdict[int(wpg)][0]
    return rgb

def __rgb2h(r, g, b):
    var_max = max(r,g,b)
    var_min = min(r,g,b)
    if var_max == var_min:
        return 0.0
    elif var_max == r:
        return (60.0 * ((g - b) / (var_max - var_min)) + 360) % 360.0
    elif var_max == g:
        return 60.0 * ((b - r) / (var_max - var_min)) + 120
    elif var_max == b:
        return 60.0 * ((r - g) / (var_max - var_min)) + 240.0

def cmy2hsv(cmy):
    C = float(cmy.split(c)[0]) / 100.0
    M = float(cmy.split(c)[1]) / 100.0
    Y = float(cmy.split(c)[2]) / 100.0
    r = 1 - C
    g = 1 - M
    b = 1 - Y 
    var_max = max(r,g,b)
    var_min = min(r,g,b)
    var_H = __rgb2h(r,g,b)
    if var_max == 0:
        var_S = 0
    else:
        var_S = 1.0 - (var_min / var_max)       
    var_V = var_max
    h = int(var_H)
    s = int(var_S * 100.0)
    v = int(var_V * 100.0)
    return str(h)+c+str(s)+c+str(v)


def hsv2cmy(hsv):
    # H values are in degrees and are 0 to 360
    # S values are 0..100
    # V values are 0..100
    c = ','
    H = float(hsv.split(c)[0])
    S0 = float(hsv.split(c)[1])
    V0 = float(hsv.split(c)[2])
    if V0 > 100.0:
        V0 = 100.0
    S = S0 / 100.0
    V = V0 / 100.0
    h_floored = int(H)
    h_sub_i = int(h_floored / 60) % 6
    var_f = (H / 60.0) - (h_floored / 60)
    var_p = V * (1.0 - S)
    var_q = V * (1.0 - var_f * S)
    var_t = V * (1.0 - (1.0 - var_f) * S)
       
    if h_sub_i == 0:
        r = V
        g = var_t
        b = var_p
    elif h_sub_i == 1:
        r = var_q
        g = V
        b = var_p
    elif h_sub_i == 2:
        r = var_p
        g = V
        b = var_t
    elif h_sub_i == 3:
        r = var_p
        g = var_q
        b = V
    elif h_sub_i == 4:
        r = var_t
        g = var_p
        b = V
    elif h_sub_i == 5:
        r = V
        g = var_p
        b = var_q
    C = (1.0 - r) * 100
    M = (1.0 - g) * 100
    Y = (1.0 - b) * 100
    cmy = str(int(C))+c+str(int(M))+c+str(int(Y))
    return cmy

def __bin(x):
    # returns nearest preferred color value
    # (0,8,13,20,30,40,50,60,70,100)
    if x <=4:     # x ~ 0
        return 0
    elif x <= 10: # x ~ 8
        return 1
    elif x <= 17: # x ~ 13
        return 2
    elif x <= 25: # x ~ 20
        return 3
    elif x <= 35: # x ~ 30
        return 4
    elif x <= 45: # x ~ 40
        return 5
    elif x <= 55: # x ~ 50
        return 6
    elif x <= 65: # x ~ 60
        return 7
    elif x <= 84: # x ~ 70
        return 8
    else: # x ~ 100
        return 9

def cmy2wpg(cmy):
    C = int(cmy.split(c)[0])
    M = int(cmy.split(c)[1])
    Y = int(cmy.split(c)[2])
    wpg = 100 * __bin(C) + 10 * __bin(Y) + __bin(M)
    return str(wpg)

def wpg2cmy(wpg):
    valdict = {'0':0,'1':8,'2':13,'3':20,'4':30,'5':40,'6':50,'7':60,'8':70,'9':100}
    C = valdict[wpg[0]]
    M = valdict[wpg[2]]
    Y = valdict[wpg[1]]
    cmy = str(C)+c+str(M)+c+str(Y)
    return cmy
